from django.urls import path
from rest_framework.documentation import include_docs_urls
from rest_framework.routers import DefaultRouter
from apps.Info import views

from drf_yasg import openapi
from drf_yasg.views import get_schema_view

# 配置信息
schema_view = get_schema_view(
    openapi.Info(
        title="Django-Rest-Framework API",  # 接口文档名称
        default_version='v0.01',  # 接口文档版本
        contact=openapi.Contact(email="3441292862@qq.com"),  # 开发者邮箱地址
        license=openapi.License(name="MIT License"),  # 许可证
    ),
    public=True,  # 是否公开
    permission_classes=[],
)

docs_urlpatterns = [
    path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='redoc'),
    path("swagger/", schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
    path('docs/', include_docs_urls(title="docs", authentication_classes=[], permission_classes=[])),
]

router = DefaultRouter()

router.register('info', views.InfoModelsViewSet)

urlpatterns = router.urls
